<template>
    <!--    <div>载体</div>-->
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
            <el-form-item label="任务编号" prop="assignmentNumber">
                <el-input v-model="queryParams.assignmentNumber" placeholder="请输入任务编号" clearable style="width: 240px"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="任务名称" prop="assignmentName">
                <el-input v-model="queryParams.assignmentName" placeholder="请输入任务名称" clearable style="width: 240px"
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>
        <el-row :gutter="10" class="mb8" ref="refbut">
            <!-- <el-col :span="1.5">
                 <el-button type="success" plain icon="el-icon-download" @click="handleExport">导出</el-button>
            </el-col> -->
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>

        <el-table ref="table" v-loading="loading" :data="dataList" :height="tableHeight" border stripe>
            <el-table-column type="selection" width="50" align="center" fixed="left" />
            <el-table-column label="序号" sortable align="center" type="index" prop="id" />
            <el-table-column label="任务编号" prop="assignmentNumber" align="center" :show-overflow-tooltip="true" />
            <el-table-column label="任务名称" prop="assignmentName" align="center" :show-overflow-tooltip="true" />
            <el-table-column label="原地址" prop="originalAddress" align="center"></el-table-column>
            <el-table-column label="备份地址" prop="backupAddress" align="center"></el-table-column>
          
            <el-table-column label="最新开始时间" prop="createTime" align="center"></el-table-column>
            <el-table-column label="最新结束时间" prop="endTime" align="center"></el-table-column>
            <el-table-column label="操作" align="center" width="300px">
                <template slot-scope="scope">
                    <el-button plain type="success" size="mini" @click="handleRestore(scope.row)">还原</el-button>
                </template>
            </el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList" />



   
    </div>
</template>
    
<script>
import estimateTableHeight from "@/mixins/estimateTableHeight";

import { list, restore} from "@/api/cqbc/backupRestore/filebackupLog.js"
export default {
    mixins: [estimateTableHeight], // 混入方法
    archive_Dicts: ['CARRIER_TYPE'],
    data() {
        return {
            loading: true,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            dataList: [],
            total: 0,
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                assignmentNumber: undefined,
                assignmentName: undefined
            },
        }
    },
    created() {
        this.getList()
    },
    methods: {
     
        getList() {
            list(this.queryParams).then(response => {
                this.dataList = response.rows
                this.total = response.total
                this.loading = false
            })
        },

   
        handleQuery() {
            this.getList();
        },

        resetQuery() {
            this.queryParams = {
                pageNum: 1,
                pageSize: 10,
                assignmentNumber: undefined,
                assignmentName: undefined
            },
                this.getList();
        },

        handleRestore(row) {
            var that=this;
            const id = row.id || this.ids
            this.$modal.confirm('是否确认还原任务名称为"' + row.assignmentName + '"的数据项？').then(() => {
                that.$modal.loading("还原中...")
                restore({filebackupId:row.filebackupId}).then(res => {
                    if (res.code == "200") {
                        that.$modal.closeLoading()
                        this.$modal.msgSuccess("还原成功");
                        this.getList();
                    }
                }).catch(() => {
                that.$modal.closeLoading()
             });
            }).catch(() => {
                that.$modal.closeLoading()
             });
        },
       
    }
}
</script>
    
<style></style>
    